package cn.edu.hunan.pm.mapper;
import cn.edu.hunan.pm.Entity.Law;
import org.apache.ibatis.annotations.*;
import java.util.List;


@Mapper
public interface LawMapper {
    @Insert("INSERT INTO laws(title, publishDate, detailContent) VALUES(#{title}, #{publishDate}, #{detailContent})")
    void insert(Law law);

    @Delete("DELETE FROM laws WHERE lawId = #{lawId}")
    void deleteById(Integer lawId);

    @Update("UPDATE laws SET title = #{title}, publishDate = #{publishDate}, detailContent = #{detailContent} WHERE lawId = #{lawId}")
    void update(Law law);

//    @Select("SELECT * FROM laws WHERE lawId = #{lawId}")
//    Law findById(Integer lawId);

    @Select("SELECT * FROM laws")
    List<Law> findAll();
}
